-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Adap-207] remove subshell around get show sql with limit predicate #249
Conversation
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide. |
71a34a5
to
6d7e8c0
Compare
6d7e8c0
to
780f804
Compare
) as model_limit_subq | ||
limit {{ limit }} | ||
{% macro default__get_limit_sql(sql, limit) %} | ||
{{ compiled_code }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VersusFacit and @mikealfare Looks like this line should be using the function parameter {{ sql }}
. It works with {{ compiled_code }}
I assume because of the context being set in the get_show_sql macro, but that's likely hiding a future bug.
I could be wrong, but ran into this when providing a custom version of get_show_sql in my project.
resolves #207
Problem
We want to undo the subshelling of
--limit
modifieddbt
commands, likerun
andshow
. This is particularly important for the user experience ofshow
, where subshelling plus--limit
results in non guaranteed to be ordered results for display.Solution
Alter
get_show_sql
to wrap an macro dispatch call: By default we simply append alimit
predicate. This leaves the door open to users who wish to alter their SQL.Things done:
--limit
predicates ondbt show
My local tests using Redshift as the adapter substrate:
Things not done:
--limit
and inlinelimit
together will flag a syntax error.Checklist